package com.lnsf.bookstore.system.advertise.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lnsf.bookstore.system.advPosition.vo.AdvPosition;
import com.lnsf.bookstore.system.advertise.dao.AdvertiseMapper;
import com.lnsf.bookstore.system.advertise.service.AdvertiseService;
import com.lnsf.bookstore.system.advertise.vo.Advertise;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class AdvertiseServiceImpl implements AdvertiseService {

    @Autowired
    private AdvertiseMapper advertiseMapper;

    @Override
    public PageInfo<Advertise> selectAll(Map<String, Object> map, Advertise Advertise) {
        PageHelper.startPage(Integer.parseInt(map.get("page").toString()),Integer.parseInt(map.get("limit").toString()));
        return new PageInfo<Advertise>(advertiseMapper.selectAll());
    }

    @Override
    public Advertise queryObject(Integer id) {
        return advertiseMapper.selectByPrimaryKey(id);
    }

    @Override
    public int deleteBatch(Integer[] ids) {
        return 0;
    }

    @Override
    public int update(Advertise advertise) {
        return advertiseMapper.updateByPrimaryKeySelective(advertise);
    }

    @Override
    public int save(Advertise advertise) {
        return advertiseMapper.insertSelective(advertise);
    }
}
